/*
* Copyright (C) Microsoft. All rights reserved.  
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not 
* use this file except in compliance with the License.  You may obtain a copy 
* of the License at http://www.apache.org/licenses/LICENSE-2.0  
* 
* THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 
* WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
* MERCHANTABLITY OR NON-INFRINGEMENT. 
*
* See the Apache License, Version 2.0 for specific language governing 
* permissions and limitations under the License.
*
*/
#pragma once

#include <baja/common.hpp>
#include <baja/vars.hpp>
#include <baja/graphics.hpp>

namespace baja { namespace app {

namespace b = baja;
namespace g = baja::graphics;

struct ivar_console_observer : public ibase
{
    BAJA_INTERFACE_NOTAG(ivar_console_observer);

    virtual void onBeforeVarChange(const std::shared_ptr<ivar_wrapper>& var, const std::shared_ptr<ivar_group>& group) = 0;
    virtual void onAfterVarChange(const std::shared_ptr<ivar_wrapper>& var, const std::shared_ptr<ivar_group>& group) = 0;
};

struct ivar_console : public g::irender_object
{
    BAJA_INTERFACE(ivar_console, "BB6C09B1-EE92-4da7-A377-3E063CA16729")

    virtual std::shared_ptr<b::ivar_group> getRoot() = 0;

    virtual bool getIsVisible() = 0;
    virtual void setIsVisible(bool isVisible) = 0;

    virtual void moveSelectionUp() = 0;
    virtual void moveSelectionDown() = 0;
    virtual void decrementSelection() = 0;
    virtual void incrementSelection() = 0;
    virtual void activateSelection() = 0;
    virtual void navigateBack() = 0;

    virtual b::int32 addObserver(const std::shared_ptr<ivar_console_observer>& observer) = 0;
    virtual void removeObserver(const std::shared_ptr<ivar_console_observer>& observer) = 0;
    virtual void removeObserver(const b::int32 cookie) = 0;
};

std::shared_ptr<ivar_console> createVarConsole(const std::shared_ptr<b::ivar_group>& root);

}} // namespace baja::app

#include <baja/app/var_console_impl.hpp>
